<script setup>
import {onMounted, reactive} from "vue";
import axios from "axios";

let jsonData = reactive({code: 1, content: '我努力不是为了你，而是因为你'})
let loveMessage = () => {
  axios({
    method: 'get',
    url: 'https://api.shadiao.pro/chp',
  }).then(function (response) {
    console.log(response)
    console.log(response.data)
    jsonData.content =response.data.data.text
  }).catch(function (error) {
    console.log(error)
  })
}
onMounted(() => {
  loveMessage()
})
</script>

<template>
  <div>
    {{ jsonData.content }}
    <button @click="loveMessage">get</button>
  </div>

</template>

<style scoped>

</style>
